﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ManterUsuario.aspx.cs" Inherits="ManterUsuario" Title="Untitled Page" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="demoheading" style="width:400"> Manter Cliente</div>
    <div class="collapsePanelHeader" style="width:400px; height:15px">Consultar Usuário</div>
        
    <div style="width:400px">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">    
            <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" DataSourceID="obsUsuario" Width="352px">
                    <Columns>
                        <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                        <asp:BoundField DataField="Nome" HeaderText="Nome" SortExpression="Nome" />
                        <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                        <asp:BoundField DataField="Tipo" HeaderText="Tipo" SortExpression="Tipo" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="lbAtualiza" runat="server" onclick="lbAtualiza_Click">Atualiza</asp:LinkButton>
                                &nbsp;<asp:LinkButton ID="lbRemove" runat="server" onclick="lbRemove_Click">Remove</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <asp:LinkButton ID="lbAtualiza" runat="server" onclick="lbAtualiza_Click">Atualiza</asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="lbRemove" runat="server" onclick="lbRemove_Click">Remove</asp:LinkButton>
                    </EmptyDataTemplate>
                </asp:GridView>                  
                <asp:ObjectDataSource ID="obsUsuario" runat="server" 
                    DataObjectTypeName="Negocios.Usuario" DeleteMethod="Remove" 
                    InsertMethod="Insere" OldValuesParameterFormatString="original_{0}" 
                    SelectMethod="ConsultaTodos" TypeName="Negocios.UsuarioBLL" 
                    UpdateMethod="Atualiza"></asp:ObjectDataSource>
                <br />
            </ContentTemplate>
        </asp:UpdatePanel>    
    </div>
    <br />
    <div class="collapsePanelHeader" style="width:400px; height:15px"></div>    
    <div style="width:400px">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">    
            <ContentTemplate>               
                <table style="width: 100%" class="divDados">
                    <tr class="divOID">
                        <td>
                            <asp:Label ID="Label1" runat="server" Text="Identificação"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="tbId" runat="server" Enabled="False"></asp:TextBox>
                            <asp:Button ID="btNovo" runat="server" Text="Novo" onclick="Button3_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 19px">
                            <asp:Label ID="Label2" runat="server" Text="Nome"></asp:Label>
                        </td>
                        <td style="height: 19px">
                            <asp:TextBox ID="tbNome" runat="server" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label3" runat="server" Text="E-mail"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="tbEmail" runat="server" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label4" runat="server" Text="Tipo"></asp:Label>
                        </td>
                        <td>
                            <asp:RadioButtonList ID="rbTipo" runat="server" Enabled="False">
                                <asp:ListItem Value="1" Selected="True">Administrador</asp:ListItem>
                                <asp:ListItem Value="2">Usuário</asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Label5" runat="server" Text="Senha"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="tbSenha" runat="server" Enabled="False" TextMode="Password"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <asp:Button ID="btGravar" runat="server" Text="Gravar" Enabled="False" 
                                onclick="btGravar_Click" />
                            <cc1:ConfirmButtonExtender ID="btGravar_ConfirmButtonExtender" runat="server" 
                                ConfirmText="Deseja realmente gravar?" Enabled="True" 
                                TargetControlID="btGravar">
                            </cc1:ConfirmButtonExtender>
                            &nbsp;
                            <asp:Button ID="btCancelar" runat="server" Text="Cancelar" Enabled="False" 
                                onclick="btCancelar_Click" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Label ID="lbErro" runat="server" CssClass="erro"></asp:Label>
                <br />
            </ContentTemplate>
        </asp:UpdatePanel>      
    </div>
</asp:Content>

